Skip to content

fix(vanish): correct VanishStatusChangeEvent argument order to prevent NPE from console#6497

Closed
Touchie771 wants to merge 1 commit intoEssentialsX:2.xfrom
Touchie771:fix/vanish-status-change-npe
Closed

fix(vanish): correct VanishStatusChangeEvent argument order to prevent NPE from console#6497
Touchie771 wants to merge 1 commit intoEssentialsX:2.xfrom
Touchie771:fix/vanish-status-change-npe

Conversation

@Touchie771
Copy link
Copy Markdown
Contributor

Information

This PR fixes #6388.

Details

Proposed fix:

Swap the arguments so affected = user (the vanish target, never null) and controller = sender (null when console, which is valid and expected by the API).

Additionally, a defensive null guard is added to BukkitListener.onVanishStatusChange() to prevent crashes from any third-party plugin that fires VanishStatusChangeEvent with a null affected user.
Environments tested:

OS: Linux

Java version: 21

  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8
  • Paper 1.21.8

@mdcfe
Copy link
Copy Markdown
Member

mdcfe commented Apr 12, 2026

Changing the parameter order will silently break all existing plugins that read these parameters swapped. I believe AfkStatusChangeEvent suffers from the same issue. We can document that these are wrong and have done so in the past, but I'm not inclined to swap the order without a larger API change (ie a new, separate event class or new set of getters on this event).

@JRoy
Copy link
Copy Markdown
Member

JRoy commented Apr 12, 2026

Succeeded by #6510

@JRoy JRoy closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could not pass event VanishStatusChangeEvent to EssentialsDiscord ...

3 participants